package com.vooda.business_admin.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.vooda.business_admin.common.ReqDataTableDto;
import com.vooda.business_admin.common.RspDataTableDto;
import com.vooda.business_admin.dao.SysUserMapper;
import com.vooda.business_admin.dao.UserMapper;
import com.vooda.business_admin.entity.SysUser;
import com.vooda.business_admin.entity.User;
import com.vooda.business_admin.service.SysUserService;
import com.vooda.business_admin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
@Transactional(readOnly = true)
public class UserServiceImpl implements UserService{

    @Autowired
    private UserMapper userMapper;

    @Override
    public RspDataTableDto<User> findUserList(ReqDataTableDto reqDataTableDto) {
        PageHelper.startPage(reqDataTableDto.getPage()+1,reqDataTableDto.getLength());
        List<User> list = userMapper.findAllList();
        PageInfo<User> pageInfo =  new PageInfo<User>(list);
        return new RspDataTableDto<User>(reqDataTableDto.getDraw(),pageInfo.getTotal(),pageInfo.getList());
    }

}
